#pragma once

#include "BasicType.h"

namespace LightPlayer{

	struct FileMapInfo{
		uint32 length;
		uint8* buffer;

		FileMapInfo(uint32 _length=0, uint8* _buffer=NULL){
			length = _length;
			buffer = _buffer;
		}

		bool operator==(const FileMapInfo& ref) const {
			return (length == ref.length) && (buffer == ref.buffer);
		}
		bool operator!=(const FileMapInfo& ref) const {
			return !( *this == ref);
		}

		static const FileMapInfo EMPTY_FILE;
	};

	typedef map<string,FileMapInfo> FileStorageMapType;


	class LightFileStorageManager{
		FileStorageMapType m_FileStorageMap;

		LightFileStorageManager();
		~LightFileStorageManager();
	public:
		static LightFileStorageManager*		getInstance();
		void								addFileToStorage( const string& key, uint8* file, uint32 length );
		const FileMapInfo&					getFile( const string& key ) const;
		
		const FileMapInfo&					getLoadedSwfFile( const char* fileName );
	};

};